package com.heima.user.controller.v1;

import com.heima.common.constants.admin.AdminConstants;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dtos.ApUserDto;
import com.heima.user.service.ApUserRealnameService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "用户管理",tags = "user",description = "用户管理API")
@RestController
@RequestMapping("/api/v1/auth")
public class ApUserRealnameController {
    @Autowired
    private ApUserRealnameService apUserRealnameService;

    @ApiOperation("用户分页列表查询")
    @PostMapping("/list")
    public ResponseResult findPage(@RequestBody ApUserDto dto){
        return apUserRealnameService.findPage(dto);
    }

    @PostMapping("authFail")
    public ResponseResult authFail(@RequestBody ApUserDto dto){
        return apUserRealnameService.updateStatusById(dto, AdminConstants.FAIL_AUTH);
    }
    @PostMapping("authPass")
    public ResponseResult authPass(@RequestBody ApUserDto dto){
        return apUserRealnameService.updateStatusById(dto, AdminConstants.PASS_AUTH);
    }
}
